#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

int get_seconds(int h, int m, int s)
{
    return h * 3600 + m * 60 + s;
}

int get_time()
{
    string line;
    getline(cin, line);
    if (line.back() != ')')
        line += " (+0)";
    int h1, m1, s1, h2, m2, s2, d;
    sscanf(line.c_str(), "%d:%d:%d %d:%d:%d (+%d)", &h1, &m1, &s1, &h2, &m2, &s2, &d);
    return get_seconds(h1, m1, s1) - get_seconds(h2, m2, s2) + d * 3600 * 24;
}

int main()
{
    int n;
    cin >> n;
    string line;
    getline(cin, line);
    while (n--)
    {
        int time = (get_time() - get_time()) / 2;
        int h = time / 3600, m = time % 3600 / 60, s = time % 60;
        printf("%02d:%02d:%02d", h, m, s);
    }

    return 0;
}